// React基础组件
import React from 'react'
// dva 连接组件 - 连接route和model
import { connect } from 'dva'
// 引入antd的组件
import { Form, Popconfirm, Row, Col, Button, Input, Cascader, Select, DatePicker, Icon, Modal, Tooltip, message, Table, Radio } from 'antd'
const confirm = Modal.confirm;

//导入路由组件，用于跳转等
import { Link, hashHistory } from 'dva/router'
// 导入项目全局配置文件
import config from 'config/config'
import { get } from 'lodash'
// 引入model取值工具方法
import { mapStateToProps } from 'utils/view_utils'
// 当前组件样式
import styles from './liveDetailStyle.less'
import classnames from 'classnames/bind';
let cx = classnames.bind(styles);
import Uploader from 'widget/Upload'
import { CollapsiblePanels } from 'widget/CollapsiblePanels/index'
import { Grid, QueryCondition } from 'widget/Grid/index'
import { AdvanceSearch } from 'widget/CollapsiblePanels/index'
// import cx from 'classnames';
import ListPage from 'widget/PageTmpl/ListPage'


import moment from 'moment';
import { number } from 'prop-types'
import SelectModal from 'widget/selectActivityModal/index'




const FormItem = Form.Item;
const InputGroup = Input.Group;
const { RangePicker } = DatePicker
const Option = Select.Option




//form默认样式
const formItemLayout = {
	labelCol: { span: 3 },
	wrapperCol: { span: 19 },
};
const formItemLayoutLink = {
	labelCol: { span: 3 },
	wrapperCol: { span: 20 },
};
const formItemLayout1 = {
	labelCol: { span: 6 },
	wrapperCol: { span: 17 },
};
const formItemLayoutTime = {
	labelCol: { span: 5 },
	wrapperCol: { span: 18 },
};
const formItemLayout4 = {
	labelCol: { span: 3 },
	wrapperCol: { span: 20 },
};
const formItemLayout5 = {
	labelCol: { span: 10 },
	wrapperCol: { span: 10 },
};
const columns = [
	{ title: '姓名', dataIndex: 'name', key: 'name', },
	{
		title: '性别', dataIndex: 'sex', key: 'sex',
		render: (text, x, index) => {
			let txt = ""
			if (x.sex == 0) {
				txt = "女"
			} else if (x.sex == 1) {
				txt = "男"
			}
			return <div>
				{txt}
			</div>
		}
	},
	{ title: '手机号', dataIndex: 'mobile', key: 'mobile', },
]

/**
 * description 路由视图及事件处理
 * dispatch 分发到models中的effects对应事件名
 * model 用于获取models中state定义的数据
 * form 表单对象
 */
const liveDetailView = function ({ dispatch, model, form, location, x }) {
	// 表单的子函数
	const { resetFields, getFieldDecorator, validateFields, setFieldsValue } = form
	// 取出model对象，命名空间
	const { modelObj, namespace } = model

	let { detail, actionType, btnLoading, areaList, estateList, imgModal, uuseeList, counselorList, liveListDemo, preVideoUrlArr = [], recordVideoUrlArr = [], searchBox, detailData, consultantList, selectRows, confirmRows, activityModalObj, relatItem, biz, currentItem = [], liveBroadcastRelats = {}, iconList, gameObj, gameBiz, couponObj, couponBiz, isDisabled, killObj, killBiz } = modelObj


	// 分页
	const pagination = {
		current: Number(detailData.pageNo || 1),
		pageNo: Number(detailData.pageNo || 1),
		pageSize: Number(detailData.pageSize || 10),
		total: Number(detailData.total),
		showTotal: e => '共 ' + detailData.total + ' 条',
		showSizeChanger: true,
		showQuickJumper: true,
		onChange: changePage, //分页事件
		onShowSizeChange: changePage, //每页条数
	}
	const rowSelection = {
		onChange: (selectedRowKeys, selectedRows) => {
			console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
			let selectRows = selectedRows[0]
			dispatch({
				type: `${namespace}/updateStore`,
				payload: { selectRows }
			})
		},
		getCheckboxProps: record => ({
		}),
	};
	function inputChange(value, type, selectedOptions) {
		console.log(value, type)
		if (type == 'areaId') {
			// console.log(selectedOptions)
			detail.provinceCode = value[0]
			detail.province = value[0]
			detail.cityCode = value[1]
			// detail.provinceName = selectedOptions[0].label
			// detail.cityName = selectedOptions[1].label
			detail.city = value[1]
			detail.productId = ""
			detail.projectId = ""
			detail.projectName = ""
			detail.productName = ""
			counselorList = []
			detail.uid = ""
			form.resetFields(['projectId'])
			// form.resetFields();

			//切换项目，清除上一活动数据
			dispatch({ type: `${namespace}/initActivity` })
			dispatch({ type: `${namespace}/getHouseArea`, payload: { province: value[0], city: value[1] } })
			changeState({ counselorList })

		} else if (type == 'projectId') {
			let prjectInfo = estateList.filter((item, idx) => item.outerId == value)
			let { productId, name } = prjectInfo[0]

			detail.productId = productId
			detail.projectId = value
			detail.projectName = name
			detail.productName = name

			//切换项目，清除上一活动数据
			dispatch({ type: `${namespace}/initActivity` })
			dispatch({ type: `${namespace}/getCounselor`, payload: { projectId: productId } })

		} else if (type == 'uid') {
			detail[type] = value
			detail.uid = ''
			counselorList.forEach(item => {
				if (item.uid == value) {
					detail.uid = item.uid
				}
			})
		} else if (type == 'type' && value == 3) {
			detail.linkUrl = ''
			detail[type] = value
		} else if (type == 'uuseeConfigId') {
			if (value != '1247429245153861632') {
				detail.preVideoUrl = ''
				preVideoUrlArr = []
				detail.recordVideoUrl = ''
				recordVideoUrlArr = []
				dispatch({
					type: `${namespace}/updateStore`,
					payload: { detail, preVideoUrlArr, recordVideoUrlArr }
				})
			} else if (value == '1247429245153861632') {
				// delete detail.type
				detail.type = '3'
			}
			detail[type] = value
		} else if (type == 'iconUrl') {
			liveBroadcastRelats.ACTIVITY[0].iconUrl = value
			changeState({ liveBroadcastRelats })
		} else if (type == 'remindType') {
			detail[type] = value
			if (value == 3) {
				delete detail.remindNum
			}
		}
		else {
			detail[type] = value
		}
		changeState({ detail })

	}

	function searchChange(name, value) {
		let obj = { [name]: value }
		detailData = Object.assign(detailData, obj)
		changeState({ detailData })
	}
	function handleSearch() {
		dispatch({ type: `${namespace}/searchAnchor`, payload: { ...detailData } })
	}
	//封面图改变时
	function updateImageModel(value, type) {
		detail[type] = value
		changeState({ detail })
	}

	function changeImgModal(visible = false, srcs = []) {
		// console.log(imgModal)
		imgModal.visible = visible
		imgModal.srcs = srcs || modelObj.srcs
		changeState({ imgModal })
	}
	//日期改变时
	function dateChange(m, s, type) {
		changeState({
			detail: {
				...detail,
				effectiveStartTime: s[0],
				effectiveEndTime: s[1],
			}
		})
	}
	//提交
	function submit(type) {
		form.validateFields((err, values) => {
			if (!err) {
				dispatch({ type: `${namespace}/saveLive`, payload: { type } })
			} else {
				message.warn('请输入完整信息')
			}
		});
	}
	function publish() {
		//   let username = localStorage.getItem('username')
		//   if(detail.id){
		// 	dispatch({ type: `${namespace}/publish`,
		// 		payload: {  
		// 			id:detail.id,
		// 			updatePerson: username
		// 			} 
		// 	})
		//   }else{
		submit('publish')
		//   }

	}

	function cancelPublish() {
		dispatch({ type: `${namespace}/cancelPublish`, payload: { id: detail.id } })
	}

	function removeImgUrl(type) {
		detail[type] = ''
		// 删除已上传的视频
		if (type == 'preVideoUrl') {
			preVideoUrlArr = []
		} else if (type == 'recordVideoUrl') {
			recordVideoUrlArr = []
		}
		dispatch({
			type: `${namespace}/updateStore`,
			payload: { detail, preVideoUrlArr, recordVideoUrlArr }
		})
		changeState({ detail })
	}

	//修改状态
	const changeState = (payload) => {
		dispatch({
			type: `${namespace}/updateStore`,
			payload: { ...payload }
		})
	};

	//上传视频方法
	function updateImageModel2(value, fileObj) {
		console.log('fileObj', fileObj)
		let videoObj = {
			url: value,
			name: value,
		}
		preVideoUrlArr = []
		if (detail.preVideoUrl) {
			detail.preVideoUrl = videoObj.url
			preVideoUrlArr.push(videoObj)
		} else {
			detail.preVideoUrl = ''
			detail.preVideoUrl = videoObj.url
			preVideoUrlArr.push(videoObj)
		}
		dispatch({
			type: `${namespace}/updateStore`,
			payload: { detail, preVideoUrlArr }
		})
	}
	function changeSearchBox(visible = true) {
		// console.log(imgModal)
		searchBox.visible = visible
		changeState({ searchBox })
	}
	//上传录制视频方法
	function updateImageModel3(value, fileObj) {
		console.log('fileObj', fileObj)
		let videoObj = {
			url: value,
			name: value,
		}
		recordVideoUrlArr = []
		if (detail.recordVideoUrl) {
			detail.recordVideoUrl = videoObj.url
			recordVideoUrlArr.push(videoObj)
		} else {
			detail.recordVideoUrl = ''
			detail.recordVideoUrl = videoObj.url
			recordVideoUrlArr.push(videoObj)
		}
		dispatch({
			type: `${namespace}/updateStore`,
			payload: { detail, recordVideoUrlArr }
		})
	}
	function changeSearchBox(visible = true) {
		// console.log(imgModal)
		searchBox.visible = visible
		changeState({ searchBox })
	}
	function changePage(page, pageSize) {
		dispatch({
			type: `${namespace}/searchAnchor`,
			payload: { ...detailData, pageNo: page, pageSize }
		});
	}
	function changeSearchOk() {
		confirmRows = selectRows
		if(!confirmRows.mobile){
			message.warn('手机号不能为空')
			return false;
		}
		detail.anchorMobile = confirmRows.mobile
		detail.anchorName = confirmRows.name
		//detail.counselorAccountId = confirmRows.accountId
		setFieldsValue({ 'uid': confirmRows.uid })
		dispatch({
			type: `${namespace}/updateStore`,
			payload: { detail, confirmRows }
		})
		changeSearchBox(false)
	}






	let pageProps = {
		'1': {
			ui: {
				// 页面接口地址
				api_url: 'admin/news/list',
				// 接口方式
				method: 'POST',
				headers: {
					'Content-type': 'application/json'
				},
				app: '',
				selectedRowKeys: [],
				// 接口参数
				params: `pageNo=1&pageSize=10&channel=3&status=1&published=1&businessId=${detail.productId}`,
				// 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
				// "mockData": mockData,
				mockData: null,
				// 查询栏
				search_bar: {
					fields: [
					],

					pasteTargetList: [  // 列表组件中将输入框的en_name作为默认id(也可以通过id另外设置)
						'carName',  // 将需要粘贴事件拦截的输入框id以数组的形式传入, 该参数对应PasteFromClipboard组件的targetList参数
					]
				},
				// 数据表格
				'table':
				{
					rowSelectionInfo: {
						type: 'radio',
					},

					key: 'productId',
					status_params: 'status=0',
					status_text: '全部',
					// 表头字段列表
					scroll: { x: 800 },
					fields: [
						{
							en_name: 'title',
							zh_name: '资讯标题',
							// width: 150,
						},
						{
							en_name: 'businessName',
							zh_name: '项目名称',
							width: 600,
							// width: 100,
						},
						{
							en_name: 'updateTime',
							zh_name: '更新时间',
							width: 180
						},
					],
					// 表格操作
					actions: [],
				},
				action_bar: [
					{
						// label:'',
						// type:'',
						rowSelection: [],
						render: () => {
							return <Input hidden />
						},
						onClick: (e, row) => {
							console.log(e, row)
						}
					},
				]
			},
		},
		'2': {
			ui: {
				// 页面接口地址
				api_url: 'admin/liveBroadcast/queryPageByProjectId',
				// 接口方式
				method: 'POST',
				headers: {
					'Content-type': 'application/json'
				},
				app: '',
				selectedRowKeys: [],
				// 接口参数
				params: `pageNo=1&pageSize=10&projectId=${detail.projectId}`,
				// 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
				// "mockData": mockData,
				mockData: null,
				// 查询栏
				search_bar: {
					fields: [
					],

					pasteTargetList: [  // 列表组件中将输入框的en_name作为默认id(也可以通过id另外设置)
						'carName',  // 将需要粘贴事件拦截的输入框id以数组的形式传入, 该参数对应PasteFromClipboard组件的targetList参数
					]
				},
				// 数据表格
				'table':
				{
					rowSelectionInfo: {
						type: 'radio',
					},

					key: 'productId',
					status_params: 'status=0',
					status_text: '全部',
					// 表头字段列表
					scroll: { x: 800 },
					fields: [
						{
							en_name: 'activityName',
							zh_name: '活动名称',
							// width: 150,
						},
						{
							en_name: 'zsxfsj',
							zh_name: '正式选房时间',
							width: 180,
							render: (a, item, index, d, e, f) => {
								return <span>{item.selectStartTime}~{item.selectEndTime}</span>
							}
						}
					],
					// 表格操作
					actions: [],
				},
				action_bar: [
					{
						// label:'',
						// type:'',
						rowSelection: [],
						render: () => {
							return <Input hidden />
						},
						onClick: (e, row) => {
							console.log(e, row)
						}
					},
				]
			},
		},
		'3': {
			ui: {
				// 页面接口地址
				api_url: 'admin/liveBroadcast/queryPageByProjectId',
				// 接口方式
				method: 'POST',
				headers: {
					'Content-type': 'application/json'
				},
				app: '',
				selectedRowKeys: [],
				// 接口参数
				params: `pageNo=1&pageSize=10&type=0&projectId=${detail.projectId}`,
				// 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
				// "mockData": mockData,
				mockData: null,
				// 查询栏
				search_bar: {
					fields: [
					],

					pasteTargetList: [  // 列表组件中将输入框的en_name作为默认id(也可以通过id另外设置)
						'carName',  // 将需要粘贴事件拦截的输入框id以数组的形式传入, 该参数对应PasteFromClipboard组件的targetList参数
					]
				},
				// 数据表格
				'table':
				{
					rowSelectionInfo: {
						type: 'radio',
					},

					key: 'productId',
					status_params: 'status=0',
					status_text: '全部',
					// 表头字段列表
					scroll: { x: 800 },
					fields: [
						{
							en_name: 'activityName',
							zh_name: '活动名称',
							// width: 150,
						},
						{
							en_name: 'zsxfsj',
							zh_name: '正式选房时间',
							width: 180,
							render: (a, item, index, d, e, f) => {
								return <span>{item.selectStartTime}~{item.selectEndTime}</span>
							}
						}
					],
					// 表格操作
					actions: [],
				},
				action_bar: [
					{
						// label:'',
						// type:'',
						rowSelection: [],
						render: () => {
							return <Input hidden />
						},
						onClick: (e, row) => {
							console.log(e, row)
						}
					},
				]
			},
		}
	};

	(['1', '2', '3']).map((item, index) => {
		// console.log(biz, 'biohazard')
		let _biz = biz[item + '']
		if (!!_biz) {
			pageProps[item + ''].biz = _biz
			pageProps[item + ''].biz.syncBackCbf = (newbiz) => {
				// console.log(activityModalObj.hrefType, item, newbiz, 'jjjj')
				if (item == activityModalObj.hrefType) {
					newbiz.selectedRowKeys = currentItem
				}
				biz[item + ''] = newbiz
				dispatch({
					type: `${namespace}/updateStore`,
					payload: { biz }
				})
			}
		}
	})

	// 游戏表格属性配置
	let gamePageProps = {
		// ---------- 界面部分 ----------
		'ui': {
			// 页面接口地址
			'api_url': 'mideadc-game-center-service/activity/gameActivity/list',
			"data_field_name": "result.records",
			"data_pageNo": "result.current",
			"data_pageSize": "result.size",
			"data_total": "result.total",
			// 接口方式
			'method': 'GET',
			'app': 'isales-mgmt-application',
			selectedRowKeys: [],
			// 接口参数
			'params': 'launchApp=2&releaseStatus=1',
			// 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
			// "mockData": mockData,
			'mockData': null,
			// 查询栏
			'search_bar': {
				'fields': [
				],
				searchHandler: (p) => { // 自定义搜索按钮回调函数，点击搜索时触发

				},
				resetHandler: (p) => { // 自定义重置按钮回调函数，点击重置时触发
					// console.log('reset click', p)
				},
				searchCallback: params => { // 自定义搜索完成后的后调函数, 搜索完成后触发, 并将本次搜索的参数传入
					// console.log('search finish', params)
				},
			},
			// 数据表格
			'table': {
				rowSelectionInfo: {
					type: 'checkbox'
				},
				'status_params': 'status=0',
				'status_text': '全部',
				'scroll': { x: 1600 },
				// 表头字段列表"
				'fields': [
					{
						'en_name': 'gameImgUrl',
						'zh_name': '活动类型缩略图',
						width: 50,
						render: (a, item, index, d, e, f) => {
							return <img style={{ width: "50px", height: '50px' }} src={a} />
						}
					},
					{
						'en_name': 'title',
						'zh_name': '活动名称',
						width: 200
					},
					{
						'en_name': 'uuseeConfigName',
						'zh_name': '活动时间',
						width: 90,
						render: (text, item) => {
							return <div>{`${item.startTime.split(' ')[0] || ''}${item.endTime && ' ~ ' || ''}${item.endTime.split(' ')[0] || ''}`}</div>
						}
					},
					{
						'en_name': 'type',
						'zh_name': '活动状态',
						width: 100,
						render: (a, item, index, d, e, f) => {
							if (item.status == '0') {
								return <div>未发布</div>
							}
							else if (item.status == '1') {
								return <div>未开始</div>
							}
							else if (item.status == '2') {
								return <div>进行中</div>
							}
							else if (item.status == '3') {
								return <div>已结束</div>
							} else {
								return <div>-</div>
							}
						}
					},
					{
						'en_name': 'createPerson',
						'zh_name': '创建人',
						width: 100,
					},
					{
						'en_name': 'createTime',
						'zh_name': '创建时间',
						width: 180
					}
				],

				'actions': [
				],
				"action_props": {
					fixed: "right",
					width: 210
				}
			},
			// 操作栏
			action_bar: [
				{
					rowSelection: [],
					render: () => {
						return <Input hidden />
					},
					onClick: (e, row) => {
						console.log(e, row)
					}
				},
			]
		},
	}


	//   游戏表格数据更新
	if (!!modelObj.gameBiz) {
		gamePageProps.biz = modelObj.gameBiz
		gamePageProps.biz.syncBackCbf = (biz) => {
			dispatch({
				type: `${namespace}/updateStore`,
				payload: { gameBiz: biz }
			})
		}
	}


	//秒杀竞拍表格属性配置
	let killPageProps = {
		// ---------- 界面部分 ----------
		'ui': {
			// 页面接口地址
			'api_url': 'admin/seckillActivity/list',
			//   "data_field_name":"result.records",
			//   "data_pageNo":"result.current",
			//   "data_pageSize":"result.size",
			//   "data_total":"result.total",
			// 接口方式
			'method': 'POST',
			'app': 'isales-mgmt-application',
			selectedRowKeys: [],
			// 接口参数
			'params': `published=2&sellType=${killObj.type == "auction" ? "2" : "1"}&productId=${detail.productId}`,
			// 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
			// "mockData": mockData,
			'mockData': null,
			// 查询栏
			'search_bar': {
				'fields': [
				],
				searchHandler: (p) => { // 自定义搜索按钮回调函数，点击搜索时触发

				},
				resetHandler: (p) => { // 自定义重置按钮回调函数，点击重置时触发
					// console.log('reset click', p)
				},
				searchCallback: params => { // 自定义搜索完成后的后调函数, 搜索完成后触发, 并将本次搜索的参数传入
					// console.log('search finish', params)
				},
			},
			// 数据表格
			'table': {
				rowSelectionInfo: {
					type: 'radio'
				},
				'status_params': 'status=0',
				'status_text': '全部',
				'scroll': { x: 1600 },
				// 表头字段列表"
				'fields': [
					{
						'en_name': 'imageUrls',
						'zh_name': '活动缩略图',
						width: 50,
						render: (a, item, index, d, e, f) => {
							return <img style={{ width: "50px", height: '50px' }} src={item.seckillActivity.imageUrls} />
						}
					},
					{
						'en_name': 'name',
						'zh_name': '活动名称',
						width: 160,
						render: (a, item, index, d, e, f) => {
							return item.seckillActivity.name
						}
					},
					{
						'en_name': 'seckillTimeIntervals',
						'zh_name': '活动时间段',
						width: 350,
						render: function (value, item, index) {
							let arr = []
							value.map((item, index) => {
								let time = `${item.startTime || ''}${item.endTime && ' ~ ' || ''}${item.endTime || ''}`
								arr.push(time)
							})
							let html = arr.join('<br />') || ''
							return <div style={{ maxHeight: '60px', overflowY: 'auto' }} dangerouslySetInnerHTML={{ __html: html }}>
							</div>
						}
					},
					{
						'en_name': 'published',
						'zh_name': '活动状态',
						width: 80,
						render: function (value, item, index) {
							return <span> {{ 1: '未发布', 2: '已发布', 3: '已撤销', }[item.seckillActivity.published]}</span>
						}
					},
					{
						'en_name': 'createPerson',
						'zh_name': '创建人',
						width: 100,
						render: function (value, item, index) {
							return <span>{item.seckillActivity.createPerson}</span>
						}
					},
					{
						'en_name': 'createTime',
						'zh_name': '创建时间',
						width: 180,
						render: function (value, item, index) {
							return <span>{item.seckillActivity.createTime}</span>
						}
					}
				],

				'actions': [
				],
				"action_props": {
					fixed: "right",
					width: 210
				}
			},
			// 操作栏
			action_bar: [
				{
					rowSelection: [],
					render: () => {
						return <Input hidden />
					},
					onClick: (e, row) => {
						console.log(e, row)
					}
				},
			]
		},
	}


	//   秒杀表格数据更新
	if (!!modelObj.killBiz) {
		killPageProps.biz = modelObj.killBiz
		killPageProps.biz.syncBackCbf = (biz) => {
			dispatch({
				type: `${namespace}/updateStore`,
				payload: { killBiz: biz }
			})
		}
	}

	// 优惠券表格属性配置
	let couponPageProps = {
		// ---------- 界面部分 ----------
		'ui': {
			// 页面接口地址
			'api_url': 'admin/coupons/config/listByProductId',
			// 接口方式
			'method': 'POST',
			'app': 'isales-mgmt-application',
			selectedRowKeys: [],
			// 接口参数
			'params': `productId=${detail.productId}&scene=3`,
			// 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
			// "mockData": mockData,
			'mockData': null,
			// 查询栏
			'search_bar': {
				'fields': [
					//   {
					//     en_name: 'type',
					//     zh_name: '活动类型',
					//     elem_type: 'Select',
					//     elem_valid_type: 'string',
					//     cmpt_items: [
					//       {
					//         value: '3',
					//         label: '预告'
					//       }, 
					//       {
					//           value: '1',
					//           label: '直播'
					//        }, 
					//       {
					//           value: '2',
					//           label: '回放'
					//       }
					//   ]
					//   },{
					//     en_name: 'status',
					//     zh_name: '活动状态',
					//     elem_type: 'Select',
					//     elem_valid_type: 'string',
					//     cmpt_items: [
					//       {
					//           value: '1',
					//           label: '待开始'
					//        }, 
					//       {
					//           value: '2',
					//           label: '直播中'
					//       },{
					//         value: '3',
					//         label: '直播结束'
					//     },
					//     {
					//       value: '5',
					//       label: '取消'
					//   }
					//   ]
					//   },
					//   {
					//     en_name: 'title',
					//     zh_name: '活动名称',
					//     elem_type: 'Input',
					//     elem_valid_type: 'string',
					//   }
				],
				searchHandler: (p) => { // 自定义搜索按钮回调函数，点击搜索时触发

				},
				resetHandler: (p) => { // 自定义重置按钮回调函数，点击重置时触发
					// console.log('reset click', p)
				},
				searchCallback: params => { // 自定义搜索完成后的后调函数, 搜索完成后触发, 并将本次搜索的参数传入
					// console.log('search finish', params)
				},
				// pasteTargetList: [  // 列表组件中将输入框的en_name作为默认id(也可以通过id另外设置)
				//   'carName',  // 将需要粘贴事件拦截的输入框id以数组的形式传入, 该参数对应PasteFromClipboard组件的targetList参数
				// ]
			},
			// 数据表格
			'table': {
				rowSelectionInfo: {
					type: 'radio',
				},
				'status_params': 'status=0',
				'status_text': '全部',
				'scroll': { x: 1600 },
				// 表头字段列表"
				'fields': [
					{
						'en_name': 'name',
						'zh_name': '优惠券名称',
						width: 150,
					},
					{
						'en_name': 'projectName',
						'zh_name': '项目名称',
						width: 300,

					},
					{
						'en_name': 'scene',
						'zh_name': '使用场景',
						width: 80,
						render: (text, record) => {
							let sceneObj = {
								1: '普通场景',
								2: '拼团场景',
								3: '活动场景'
							}
							return (<span>{sceneObj[text]}</span>)
						}
					},
					{
						'en_name': 'type',
						'zh_name': '活动类型',
						width: 80,
						render: (text, record) => {
							return <span>{{ 1: '代金券', 2: '折扣券' }[record.type] || ''}</span>
						}
					},
					{
						'en_name': 'sqcj',
						'zh_name': '有效使用时间',
						width: 140,
						render: (text, item) => {
							return <div>{`${item.startTime || ''}${item.expireDate && ' ~ ' || ''}${item.expireDate || ''}`}</div>
						}
					},
					{
						'en_name': 'status',
						'zh_name': '状态',
						width: 80,
						render: (text, record) => {
							return <div>
								{{ 1: '未上架', 2: '已上架', 3: '已下架', 4: '已过期' }[text] || ''}
							</div>
						}
					},
				],

				'actions': [
				],
				"action_props": {
					fixed: "right",
					width: 210
				}
			},
			// 操作栏
			action_bar: [
				{
					rowSelection: [],
					render: () => {
						return <Input hidden />
					},
					onClick: (e, row) => {
						console.log(e, row)
					}
				},
			]
		},
	}


	//   游戏表格数据更新
	if (!!modelObj.couponBiz) {
		couponPageProps.biz = modelObj.couponBiz
		couponPageProps.biz.syncBackCbf = (biz) => {
			dispatch({
				type: `${namespace}/updateStore`,
				payload: { couponBiz: biz }
			})
		}
	}



	function updateModal(flag = false, obj = {}) {
		// let isProject=isProject()
		if (isProject() == false) {
			return false
		}
		let { ACTIVITY } = liveBroadcastRelats
		let visible = flag
		activityModalObj.visible = flag
		if (!visible) { //关闭
			changeState({ activityModalObj })
			return false
		}
		if (ACTIVITY.length) {
			activityModalObj.activityType = ACTIVITY[0].targetType
		}
		changeState({ activityModalObj })
	}

	const confirmHref = (getHref) => {
		let hrefInfo = {}
		let { visible = false, actionType, activityType, idx = 0, slideshowId = '' } = activityModalObj
		activityModalObj.visible = !visible
		// 判断类型，整合数据
		//

		let selectedRows = (biz[activityType] || {})['selectedRows'][0] || {}

		currentItem = selectedRows
		if (Object.keys(currentItem).length === 0) {
			changeState({ activityModalObj })
			return false
		}
		let activity = {}
		let newArr = []
		activity.relatType = 'ACTIVITY'
		activity.relatItem = relatItem[activityType]
		activity.targetType = activityType

		if (activityType == 1) {
			activity.title = currentItem.title
			activity.relatId = currentItem.contentId
			activity.startTime = currentItem.startDate
			activity.endTime = currentItem.endDate
			activity.targetType = activityType
		} else {
			activity.title = currentItem.activityName
			activity.relatId = currentItem.id
			activity.startTime = currentItem.selectStartTime
			activity.endTime = currentItem.selectEndTime
		}

		newArr.push(activity)
		liveBroadcastRelats.ACTIVITY = newArr

		changeState({ activityModalObj, currentItem, biz, liveBroadcastRelats })
	}

	//   s直播间游戏
	function gameModal(type, flag = false) {
		if (isProject() == false) {
			return false
		}
		let visible = flag
		gameObj.visible = flag
		changeState({ gameObj })
	}
	function gameOk(flag) {
		let { visible = false, } = gameObj
		gameObj.visible = !visible

		if (flag == true && !gameBiz.selectedRows.length) {
			changeState({ gameObj })
			return
		}

		let gameArr = []
		if (gameBiz.selectedRows.length > 0) {
			for (let i = 0; i < gameBiz.selectedRows.length; i++) {
				let newObj = {}
				let gameInfo = gameBiz.selectedRows[i];

				newObj.relatType = 'GAME'
				newObj.title = gameInfo.title
				newObj.relatId = gameInfo.gameActivityId
				newObj.startTime = gameInfo.startTime
				newObj.endTime = gameInfo.endTime

				gameArr.push(newObj)
			}
		}


		liveBroadcastRelats.GAME = gameArr;
		changeState({ liveBroadcastRelats, gameObj });
	}
	const gameItems = liveBroadcastRelats.GAME && liveBroadcastRelats.GAME.map((e, y) => (
		<div key={y} className={cx('div')}>{liveBroadcastRelats.GAME[y].title}{!isDisabled && <Icon className={cx('close')} type="close" onClick={() => { deleteItem('GAME', y) }} />}</div>
	));


	//   e直播间游戏


	//	s直播间秒杀活动
	function killModal(type, flag = false) {
		if (isProject() == false) {
			return false
		}
		let visible = flag
		killObj.visible = flag
		killObj.type = type
		changeState({ killObj })
	}
	function killOk(flag) {
		let { visible = false, } = killObj
		killObj.visible = !visible

		if (flag == true && !killBiz.selectedRows.length) {
			changeState({ killObj })
			return
		}

		let killArr = []
		let typeArr = killObj.type == 'auction' ? 'BID' : 'SECKILL'
		if (killBiz.selectedRows.length > 0) {
			for (let i = 0; i < killBiz.selectedRows.length; i++) {
				let newObj = {}
				let killInfo = killBiz.selectedRows[i].seckillActivity;

				newObj.relatType = killObj.type == 'auction' ? 'BID' : 'SECKILL'
				newObj.title = killInfo.name
				newObj.relatId = killInfo.seckillActivityId
				// newObj.startTime = killInfo.startTime
				// newObj.endTime = killInfo.endTime

				killArr.push(newObj)
			}
		}


		liveBroadcastRelats[typeArr] = killArr;
		changeState({ liveBroadcastRelats, killObj });
	}
	const killItems = liveBroadcastRelats['SECKILL'] && liveBroadcastRelats.SECKILL.map((e, y) => (
		<div key={y} className={cx('div')}>{liveBroadcastRelats.SECKILL[y].title}{!isDisabled && <Icon className={cx('close')} type="close" onClick={() => { deleteItem('SECKILL', y) }} />}</div>
	));
	const auctiontems = liveBroadcastRelats['BID'] && liveBroadcastRelats.BID.map((e, y) => (
		<div key={y} className={cx('div')}>{liveBroadcastRelats.BID[y].title}{!isDisabled && <Icon className={cx('close')} type="close" onClick={() => { deleteItem('BID', y) }} />}</div>
	));


	//	e直播间秒杀活动

	//   s直播间优惠券

	function couponModal(type, flag = false) {
		if (isProject() == false) {
			return false
		}
		let visible = flag
		couponObj.visible = flag
		changeState({ couponObj })
	}
	function couponOk(flag) {
		let { visible = false, } = couponObj
		couponObj.visible = !visible
		if (flag == true && !couponBiz.selectedRows.length) {
			changeState({ couponObj })
			return
		}
		let newObj = {}
		let couponArr = []

		let coupon = couponBiz.selectedRows[0]

		newObj.relatType = 'COUPONS'
		newObj.title = coupon.name
		newObj.relatId = coupon.couponsConfigId
		// newObj.startTime = coupon.startTime
		// newObj.endTime = coupon.expireDate

		couponArr.push(newObj)

		liveBroadcastRelats.COUPONS = couponArr

		changeState({ liveBroadcastRelats, couponObj })
	}


	//秒杀开始结束时间
	function getSeckillChange(m, s, type) {
		let newObj = {}
		let killArr = []

		newObj.startTime = s[0]
		newObj.endTime = s[1]
		let kill = liveBroadcastRelats.SECKILL[0]
		kill = { ...kill, ...newObj }

		killArr.push(kill)

		liveBroadcastRelats.SECKILL = killArr

		changeState({ liveBroadcastRelats })
	}

	//竞拍开始结束时间
	function getAuctionsChange(m, s, type) {
		let newObj = {}
		let auctionArr = []

		newObj.startTime = s[0]
		newObj.endTime = s[1]
		let auction = liveBroadcastRelats.BID[0]
		auction = { ...auction, ...newObj }

		auctionArr.push(auction)

		liveBroadcastRelats.BID = auctionArr

		changeState({ liveBroadcastRelats })
	}

	//直播间领券时间
	function getCouponChange(m, s, type) {
		let newObj = {}
		let couponArr = []

		newObj.startTime = s[0]
		newObj.endTime = s[1]
		let coupon = liveBroadcastRelats.COUPONS[0]
		coupon = { ...coupon, ...newObj }

		couponArr.push(coupon)

		liveBroadcastRelats.COUPONS = couponArr

		changeState({ liveBroadcastRelats })
	}

	//   e直播间优惠券

	function deleteItem(type, index) {
		confirm({
			title: '你是否删除该内容信息？',
			okText: '确定',
			cancelText: '取消',
			onOk() {
				if (type == "GAME" || type == "SECKILL") {
					liveBroadcastRelats[type].splice(index, 1);
				} else {
					liveBroadcastRelats[type] = []
				}

				changeState({ liveBroadcastRelats })
			},
			onCancel() {
				console.log('Cancel');
			},
		});

	}

	function isProject() {
		if (detail.projectId == "" || detail.projectId == null || !detail.projectId) {
			message.error('请先选择项目！')
			return false
		} else {
			return true
		}
	}

	//视频提示自定义
	var diyTooltip1 = function () {
		return <div className={styles.diyTooltip}>支持*.mp4格式文件,文件不得大于10MB<Tooltip title="预告视频在直播开始前，观众进入直播间自动播放"><Icon className={styles.iconTooltip} type="question-circle" /></Tooltip></div>
	}
	var diyTooltip2 = function () {
		return <div className={styles.diyTooltip}>支持*.mp4格式文件<Tooltip title="到达直播时间时自动播放直播视频"><Icon className={styles.iconTooltip} type="question-circle" /></Tooltip></div>
	}

	return (
		<div className={cx('pageLayout')} className={styles.couponDetail}>
			<div className='public_listMain'>
				<div className={styles.functionButton + ' functionButton'}>
					{<Button type='primary' onClick={e => submit()} disabled={actionType == 'check'} loading={btnLoading}>保存</Button>}
					{detail.published == 0 && <Button type='primary' onClick={e => publish()} disabled={actionType == 'check'} loading={btnLoading}>发布</Button>}
					{(actionType == 'edit' && detail.published == 1) && <Button type='primary' onClick={e => cancelPublish()} disabled={actionType == 'check'} loading={btnLoading}>取消发布</Button>}
				</div>
				<Form className={cx('inline')}>
					<CollapsiblePanels title="新建直播" hideUpDownBtn={true} >
						<Row>
							<Col span={12}>
								<FormItem {...formItemLayout} label="所属项目">
									{getFieldDecorator('projectId', {
										initialValue: detail.productName,
										rules: [
											{
												required: true, whitespace: true, message: '请输入所属项目',
												validator: (rule, value, callback) => {
													console.log(rule, value)
												}
											},
										],
									})(
										<InputGroup compact>
											<Cascader style={{ width: '40%' }}
												disabled={actionType != 'add'}
												options={areaList}
												value={[`${detail.province}`, `${detail.city}`]}
												onChange={(e, selectedOptions) =>
													{
														console.log(e,selectedOptions)
													
													inputChange(e, "areaId", selectedOptions)}
												}
												placeholder="请选择所属城市" />
											<Select style={{ width: '60%' }}
												notFoundContent={'该省市中无楼盘'}
												disabled={actionType != 'add'}
												value={detail.productName}
												onChange={(e) => inputChange(e, 'projectId')}
												placeholder="请选择项目">
												{
													estateList && estateList.map((item, index) => (
														<Select.Option key={`house_${index}`} value={item.outerId}>{item.name}</Select.Option>
													))
												}
											</Select>
										</InputGroup>
									)}
								</FormItem>
							</Col>
							<Col span={6}>
								<FormItem {...formItemLayout1} label="直播标题">
									{getFieldDecorator('title', {
										rules: [{
											required: true, message: '标题最多14个字', max: 14
										}],
										initialValue: detail.title,
									})(
										<Input placeholder="标题最多14个字" disabled={isDisabled} onChange={(e) => { inputChange(e.target.value, 'title') }} />
									)}
								</FormItem>
							</Col>
						</Row>
						<Row>
							<Col span={6}>
								<FormItem {...formItemLayout1} label="直播平台">
									{getFieldDecorator('uuseeConfigId', {
										initialValue: detail.uuseeConfigId,
										rules: [
											{ required: true, whitespace: true, message: '请选择平台' },
										],
									})(

										<Select
											disabled={isDisabled}
											// value={detail.parentProductId}
											onChange={(e) => inputChange(e, 'uuseeConfigId')}>
											{
												uuseeList && uuseeList.map((item, index) => {
													return <Option value={item.id} key={`uusee${index}`}>{item.uuseeName}</Option>
												})
											}
										</Select>

									)}
								</FormItem>
							</Col>
							<Col span={1}> <Tooltip title="如需支持其他直播小程序，请发邮件至集团IT-谭嘉杰tanjj9@midea.com申请开通"><Icon className={styles.iconTooltip} type="question-circle" /></Tooltip></Col>
							{detail.uuseeConfigId !== '1247429245153861632' && <Col span={6}>
								<FormItem {...formItemLayout1} label="直播类型">
									{getFieldDecorator('type', {
										initialValue: detail.type,
										rules: [
											{ required: detail.uuseeConfigId !== '1247429245153861632' ? true : false, whitespace: true, type: 'number', message: '请选择直播类型' },
										],
									})(

										<Select
											disabled={isDisabled}
											// value={detail.parentProductId}
											onChange={(e) => inputChange(e, 'type')}>
											<Option value={3} key='3'>预告</Option>
											<Option value={1} key='1'>直播</Option>
											<Option value={2} key='2'>回放</Option>
										</Select>

									)}
								</FormItem>
							</Col>}
							<Col span={11}>
								<FormItem
									{...formItemLayoutTime}
									label="直播时间"
								>
									{getFieldDecorator('effectiveTime', {
										rules: [{ required: true, message: '请选择有效期' },
										],
										initialValue: detail.effectiveStartTime ? [moment(detail.effectiveStartTime, 'YYYY-MM-DD HH:mm:ss'), moment(detail.effectiveEndTime, 'YYYY-MM-DD HH:mm:ss')] : [],
									})(

										<RangePicker
											style={{ width: "100%" }}
											disabled={isDisabled}
											showTime={{
												hideDisabledOptions: true,
												defaultValue: [moment(null, 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],

											}}
											format="YYYY-MM-DD HH:mm:ss" onChange={(date, dateString) => { dateChange(date, dateString) }}
										/>

									)}
								</FormItem>
							</Col>
						</Row>

						<Row>
							<Col span={6}>
								<FormItem {...formItemLayout1} label="屏幕方向">
									{getFieldDecorator('direction', {
										initialValue: detail.direction,
										rules: [
											{ required: true, whitespace: true, message: '请选择屏幕方向', type: 'number' },
										],
									})(
										<Radio.Group onChange={(e) => inputChange(e.target.value, 'direction')}>
											<Radio value={0}>竖屏</Radio>
											<Radio value={1}>横屏</Radio>
										</Radio.Group>
									)}
								</FormItem>
							</Col>
							<Col span={7}>
								<FormItem {...formItemLayout1} label="清晰度">
									{getFieldDecorator('definition', {
										initialValue: detail.definition,
										rules: [
											{ required: true, whitespace: true, message: '请选择清晰度', type: 'number' },
										],
									})(
										<Radio.Group onChange={(e) => inputChange(e.target.value, 'definition')}>
											<Radio value={2}>超清</Radio>
											<Radio value={1}>高清</Radio>
											<Radio value={0}>标清</Radio>
										</Radio.Group>
									)}
								</FormItem>
							</Col>
							<Col span={1}>
								<Tooltip
									title={
										<div>
											<div>清晰度说明：</div>
											<div>超清：1080P，要求2MB以上稳定带宽，对清晰度要求很高的场景使用；</div>
											<div>高清：720P，要求1MB以上稳定带宽，普通手机直播场景使用；</div>
											<div>标清：480P，要求700K以上带宽，户外、网络不稳定情况下使用</div>
										</div>

									}
								>
									<Icon className={styles.iconTooltip} type="question-circle" />
								</Tooltip>
							</Col>
						</Row>

						{detail.uuseeConfigId == '1247429245153861632' &&
							<Row>
								<Col span={6}>
									<FormItem {...formItemLayout1} label="开播方式">
										{getFieldDecorator('broadcastMode', {
											initialValue: detail.broadcastMode,
											rules: [
												{ required: true, whitespace: true, message: '请选择开播方式', type: 'number' },
											],
										})(
											<Select
												disabled={isDisabled}
												onChange={(e) => inputChange(e, 'broadcastMode')}>
												<Option value={1} key={`1`}>手机开播</Option>
												<Option value={2} key={`2`}>上传录播视频</Option>
												<Option value={3} key={`3`}>专业设备开播</Option>
											</Select>
										)}
									</FormItem>
								</Col>
								<Col span={1}>
									<Tooltip
										title={
											<div>
												<div>手机开播：主播通过手机开启直播；</div>
												<div>上传录播视频：不需要主播开播，直播时间开始后自动播放直播视频；</div>
												<div>专业设备开播：通过专业设备开启直播，支持推流和拉流。</div>
											</div>

										}
									>
										<Icon className={styles.iconTooltip} type="question-circle" />
									</Tooltip>
								</Col>
								{detail.broadcastMode === 3 &&
									<Col span={12}>
										<FormItem {...formItemLayout1} label="推流地址">
											{getFieldDecorator('pushStreamUrl', {
												rules: [{
													required: false, message: '活动发布后自动生成'
												}],
												initialValue: detail.pushStreamUrl,
											})(
												<Input placeholder="活动发布后自动生成" disabled />
											)}
										</FormItem>
									</Col>
								}

							</Row>
						}


						<Row>
							<Col span={12}>
								<FormItem {...formItemLayout} label="主播">
									{getFieldDecorator('uid'||'counselorAccountId', {
										initialValue: detail.uid||detail.counselorAccountId,
										rules: [
											{ required: true, message: '请选择主播' },
										],
									})(
										<div>
											<Col span={5}><a onClick={(e) => { changeSearchBox(true) }}>选择</a></Col>
											<Col span={5}>{confirmRows.name}</Col>
											<Col span={5}>{confirmRows.mobile}</Col>
										</div>
									)}
								</FormItem>
							</Col>

							{detail.uuseeConfigId == '1247429245153861632' &&
								<Col span={6}>
									<FormItem {...formItemLayout1} label="开播提醒">
										{getFieldDecorator('remindType', {
											initialValue: detail.remindType,
											rules: [
												{ required: false, whitespace: true, type: "number", message: '请选择开播提醒' },
											],
										})(

											<Select
												disabled={isDisabled}
												// value={detail.parentProductId}
												onChange={(e) => inputChange(e, 'remindType')}>
												<Option value={1} key='1'>当前城市用户</Option>
												<Option value={2} key='2'>关注楼盘用户</Option>
												<Option value={3} key='3'>不提醒</Option>
											</Select>

										)}
									</FormItem>
								</Col>


							}
							{detail.uuseeConfigId == '1247429245153861632' && detail.remindType && detail.remindType != 3 &&
								<Col span={6}>
									<FormItem {...formItemLayout1} label="提醒时间">
										{getFieldDecorator('remindNum', {
											initialValue: detail.remindNum,
											rules: [
												{ required: false, whitespace: true, type: "number", message: '请选择开播提醒' },
											],
										})(

											<Select
												disabled={isDisabled}
												// value={detail.parentProductId}
												onChange={(e) => inputChange(e, 'remindNum')}>
												<Option value={30} key='30'>开播前30分钟</Option>
												<Option value={10} key='10'>开播前10分钟</Option>
												<Option value={5} key='5'>开播前5分钟</Option>
											</Select>

										)}
									</FormItem>
								</Col>}
						</Row>
						{detail.uuseeConfigId !== '1247429245153861632' && <Row>
							<Col span={12}>
								<FormItem {...formItemLayoutLink} label="直播链接">
									{getFieldDecorator('linkUrl', {
										rules: [{
											required: true, message: '请输入直播对应链接地址'
										}],
										initialValue: detail.linkUrl,
									})(
										<Input placeholder="请输入直播对应链接地址" disabled={isDisabled} onChange={(e) => { inputChange(e.target.value, 'linkUrl') }} />
									)}
								</FormItem>
							</Col>
							<Col span={1}> <Tooltip title="请填入对应小程序链接地址，若无法获取，可发邮件至集团IT-谭嘉杰tanjj9@midea.com申请获取"><Icon className={styles.iconTooltip} type="question-circle" /></Tooltip></Col>
						</Row>}

						{detail.uuseeConfigId == '1247429245153861632' &&
							<Row>
								<Col className="col" span={12}>
									{/* actionType=='check'?<FormItem {...formItemLayout4} label="预告视频url"> */}
									{modelObj.actionType && modelObj.actionType == 'edit' ? <FormItem {...formItemLayout4} label="预告视频url">
										{detail.preVideoUrl &&
											<a style={{ lineHeight: 1.5 }} target="_blank" rel="noopener noreferrer" className="ant-upload-list-item-name aUrl" href={detail.preVideoUrl}>{detail.preVideoUrl}</a>
										}
									</FormItem> : <FormItem {...formItemLayout4} label="预告视频URL"
									>
											<Uploader
												uploadedUrls={preVideoUrlArr}
												removeFileCbf={(index) => { removeImgUrl('preVideoUrl') }}
												uploadSuccessCbf={(imgUrl, fileObj) => { updateImageModel2(imgUrl, fileObj) }}
												showType='5'
												disabled={isDisabled}
												accept={'.mp4'}
												uploadTip={diyTooltip1}
												fileType='video'
												fileMaxSize='10.24'
												maxFiles='1' />
										</FormItem>}
								</Col>

								{detail.broadcastMode == 2 &&
									<Col className="col" span={12}>
										{modelObj.actionType && modelObj.actionType == 'edit' ? <FormItem {...formItemLayout4} label={<label><span className={styles.required}>*</span>直播视频</label>}>
											{detail.recordVideoUrl &&
												<a style={{ lineHeight: 1.5 }} target="_blank" rel="noopener noreferrer" className="ant-upload-list-item-name aUrl" href={detail.preVideoUrl}>{detail.preVideoUrl}</a>
											}
										</FormItem> :
											<FormItem {...formItemLayout4} label={<label><span className={styles.required}>*</span>直播视频</label>}>
												<Uploader
													uploadedUrls={recordVideoUrlArr}
													removeFileCbf={(index) => { removeImgUrl('recordVideoUrl') }}
													uploadSuccessCbf={(imgUrl, fileObj) => { updateImageModel3(imgUrl, fileObj) }}
													showType='5'
													disabled={isDisabled}
													accept={'.mp4'}
													uploadTip={diyTooltip2}
													fileType='video'
													maxFiles='1' />
											</FormItem>}
									</Col>
								}

							</Row>}
						<Row>
							<Col span={12}>
								<FormItem
									{...formItemLayout4}
									extra="图片分辨率需为1372*760px，且文件大小在500kb以下，支持jpg，png格式。"
									label="直播封面图"
								>
									{getFieldDecorator('coverImageUrl', {
										initialValue: detail.coverImageUrl,
										rules: [
											{ required: true, message: '请上传直播封面图' }
										],
									})(
										<div className={cx('uploaderBox')}>
											<div className={cx('uploaderDiv')}>
												<Uploader
													uploadedUrls={detail.coverImageUrl}
													removeFileCbf={() => { removeImgUrl('coverImageUrl') }}
													uploadSuccessCbf={(imgUrl) => {
														updateImageModel(imgUrl, 'coverImageUrl')
													}}
													showType={isDisabled ? '4' : "6"}
													// showType='6'
													minCropBoxWidth={1372}
													minCropBoxHeight={760}
													unsetWidth={true}
													fileType='image'
													fileMaxSize='0.5'
													maxFiles='1'
												/>
											</div>
											<div className={cx('tipBox')}>
												<Icon type="question-circle" className={'mgr1'} style={{ color: '#08c' }} />
												<a href="javascript:void(0)" onClick={() => { changeImgModal(true, [liveListDemo[0]]) }}>封面图显示在哪里?</a>
											</div>
										</div>)}
								</FormItem>
							</Col>
							{detail.uuseeConfigId == '1247429245153861632' && <Col span={12}>
								<FormItem
									{...formItemLayoutTime}
									extra="图片分辨率需为750px*750px，且文件大小在500kb以下，支持jpg，png格式。"
									label="直播分享海报图">
									{getFieldDecorator('bottomImg', {
										initialValue: detail.bottomImg,
										rules: [
											{ required: true, message: '请上传直播分享海报图' }
										],
									})(
										<div className={cx('uploaderBox')}>
											<div className={cx('uploaderDiv')}>
												<Uploader
													uploadedUrls={detail.bottomImg}
													removeFileCbf={() => { removeImgUrl('bottomImg') }}
													uploadSuccessCbf={(imgUrl) => {
														updateImageModel(imgUrl, 'bottomImg')
													}}
													showType={isDisabled ? '4' : "6"}
													// showType='6'
													minCropBoxWidth={750}
													minCropBoxHeight={750}
													unsetWidth={true}
													fileType='image'
													fileMaxSize='0.5'
													maxFiles='1'
												/>
											</div>
											{/* <div className={cx('tipBox')}>
												<Icon type="question-circle" className={'mgr1'} style={{ color: '#08c' }} />
												<a href="javascript:void(0)" onClick={() => { changeImgModal(true, [liveListDemo[0]]) }}>封面图显示在哪里?</a>
											</div> */}
										</div>)}
								</FormItem>
							</Col>}
						</Row>
					</CollapsiblePanels>
					{detail.uuseeConfigId == '1247429245153861632' &&
						<CollapsiblePanels title="直播间配置" hideUpDownBtn={true} >
							<Row>
								<Col span={10}>
									<FormItem {...formItemLayoutTime} label="管理员">
										{getFieldDecorator('adminMobiles', {
											rules: [{
												required: true, message: '请输入管理员手机号码', pattern: /^1[3|4|5|7|8][0-9]\d{8}$/, message: '请输入正确的手机号'
											}],
											initialValue: detail.adminMobiles,
										})(
											<Input placeholder="请输入管理员手机号码" disabled={isDisabled} onChange={(e) => { inputChange(e.target.value, 'adminMobiles') }} />
										)}
									</FormItem>
								</Col>
								<Col span={1}> <Tooltip title="管理员可以在直播间进行踢人、禁言等操作"><Icon className={styles.iconTooltip} type="question-circle" /></Tooltip></Col>

								<Col span={10}>
									<FormItem {...formItemLayoutTime} label="虚拟热度">
										{getFieldDecorator('virtualHotAmount', {
											rules: [{
												required: true, message: '请输入虚拟热度，且只能输入正整数', pattern: new RegExp(/^[1-9]\d*$/, "g")
											}],
											initialValue: detail.virtualHotAmount
										})(
											<Input disabled={actionType == 'check'} placeholder="请输入虚拟热度" onChange={(e) => { inputChange(e.target.value, 'virtualHotAmount') }} />
										)}
									</FormItem>
								</Col>
								<Col span={1}> <Tooltip title="手机端热度=虚拟热度+访问人次"><Icon className={styles.iconTooltip} type="question-circle" /></Tooltip></Col>

							</Row>
							<Row>
								<Col span={12}>
									<Col span={12}>
										<FormItem {...formItemLayout5} label="直播间活动">
											{getFieldDecorator('liveBroadcastRelats', {
												rules: [{
													required: false, message: '请选择直播间活动'
												}],
												initialValue: detail.liveBroadcastRelats,
											})(
												<Button disabled={isDisabled} onClick={() => { updateModal(true) }}>选择活动 </Button>
											)}
										</FormItem>
									</Col>
									{liveBroadcastRelats.ACTIVITY.length ? <Col className={cx('label')} span={12}>活动名称：<div className={cx('div')}>{liveBroadcastRelats.ACTIVITY[0].title} {!isDisabled && <Icon className={cx('close')} type="close" onClick={() => { deleteItem('ACTIVITY') }} />}</div></Col> : ''}
								</Col>

								{liveBroadcastRelats.ACTIVITY.length ? <Col span={12}>
									<FormItem label="活动图标">
										{getFieldDecorator('iconUrl', {
											initialValue: liveBroadcastRelats.ACTIVITY.length ? liveBroadcastRelats.ACTIVITY[0].iconUrl : '',
											rules: [
												{ required: false, whitespace: true, message: '请选择礼品图' },
											],
										})(
											<Radio.Group className={cx('radioLayout')}>
												{iconList.map((item, index) => {
													return (
														<div className={cx('preview')} key={index}>
															<div className={cx('center')}>
																<div className={cx('imgbox')}>
																	<img className={cx('imgBg')} src={item} alt="活动图标" />
																</div>

																<Radio disabled={isDisabled} value={item} onChange={(e) => { inputChange(e.target.value, 'iconUrl', index) }}>选择</Radio>
															</div>
														</div>
													)
												})}
											</Radio.Group>
										)}
									</FormItem>
								</Col> : ''}
							</Row>
							<Row>
								<Col span={6}>
									<FormItem {...formItemLayout5} label="直播间游戏">
										{getFieldDecorator('game', {
											rules: [{
												required: false, message: '请选择直播间游戏'
											}],
											initialValue: liveBroadcastRelats.GAME && liveBroadcastRelats.GAME.length ? liveBroadcastRelats.GAME[0].title : '',
										})(
											<Button disabled={isDisabled} onClick={() => { gameModal('game', true) }}>选择游戏 </Button>
										)}
									</FormItem>
								</Col>
								{/* {liveBroadcastRelats.GAME[0].title} {!isDisabled&&<Icon className={cx('close')} type="close" onClick={()=>{deleteItem('GAME')}}/>} */}
								{liveBroadcastRelats.GAME && liveBroadcastRelats.GAME.length > 0 ? <Col span={18} className={cx('label')}>游戏名称：{gameItems}</Col> : ''}
							</Row>
							<Row>
								<Col span={6}>
									<FormItem {...formItemLayout5} label="直播间秒杀活动">
										{getFieldDecorator('kill', {
											rules: [{
												required: false, message: '请选择直播间秒杀活动'
											}],
											initialValue: liveBroadcastRelats.SECKILL && liveBroadcastRelats.SECKILL.length ? liveBroadcastRelats.SECKILL[0].title : '',
										})(
											<Button disabled={isDisabled} onClick={() => { killModal('kill', true) }}>选择秒杀活动 </Button>
										)}
									</FormItem>
								</Col>
								{liveBroadcastRelats.SECKILL && liveBroadcastRelats.SECKILL.length > 0 ? <Col span={7} className={cx('label')}>秒杀活动名称：{killItems}</Col> : ''}
								{liveBroadcastRelats.SECKILL.length ? <Col span={11}>
									<FormItem
										{...formItemLayoutTime}
										label="直播间秒杀时间"
									>
										{getFieldDecorator('seckillTime', {
											rules: [{ required: true, message: '请选择有效期' },
											],
											initialValue: liveBroadcastRelats.SECKILL.length && liveBroadcastRelats.SECKILL[0].startTime ? [moment(liveBroadcastRelats.SECKILL[0].startTime, 'YYYY-MM-DD HH:mm:ss'), moment(liveBroadcastRelats.SECKILL[0].endTime, 'YYYY-MM-DD HH:mm:ss')] : [],
										})(

											<RangePicker
												style={{ width: "100%" }}
												disabled={isDisabled}
												showTime={{
													hideDisabledOptions: true,
													defaultValue: [moment(null, 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],

												}}
												format="YYYY-MM-DD HH:mm:ss" onChange={(date, dateString) => { getSeckillChange(date, dateString) }}
												onOk={(date) => {
													if (new Date(date[0]).getTime() < new Date(detail.effectiveStartTime).getTime() || new Date(date[1]).getTime() > new Date(detail.effectiveEndTime).getTime()) {
														liveBroadcastRelats.SECKILL[0].startTime = null
														liveBroadcastRelats.SECKILL[0].endTime = null
														dispatch({
															type: 'updateStore',
															payload: {
																liveBroadcastRelats
															}
														})
														form.resetFields(['seckillTime'])
														message.error('秒杀活动时间一定要在直播时间段范围内', () => {
														})
														return false
													}

												}}

											/>

										)}
									</FormItem>
								</Col> : ''}
							</Row>
							<Row>
								<Col span={6}>
									<FormItem {...formItemLayout5} label="直播间竞拍活动">
										{getFieldDecorator('auction', {
											rules: [{
												required: false, message: '请选择直播间竞拍活动'
											}],
											initialValue: liveBroadcastRelats.BID && liveBroadcastRelats.BID.length ? liveBroadcastRelats.BID[0].title : '',
										})(
											<Button disabled={isDisabled} onClick={() => { killModal('auction', true) }}>选择竞拍活动 </Button>
										)}
									</FormItem>
								</Col>
								{liveBroadcastRelats.BID && liveBroadcastRelats.BID.length > 0 ? <Col span={7} className={cx('label')}>竞拍活动名称：{auctiontems}</Col> : ''}
								{liveBroadcastRelats.BID && liveBroadcastRelats.BID.length ? <Col span={11}>
									<FormItem
										{...formItemLayoutTime}
										label="直播间竞拍时间"
									>
										{getFieldDecorator('getAuctions', {
											rules: [{ required: true, message: '请选择有效期' },
											],
											initialValue: liveBroadcastRelats.BID.length && liveBroadcastRelats.BID[0].startTime ? [moment(liveBroadcastRelats.BID[0].startTime, 'YYYY-MM-DD HH:mm:ss'), moment(liveBroadcastRelats.BID[0].endTime, 'YYYY-MM-DD HH:mm:ss')] : [],
										})(

											<RangePicker
												style={{ width: "100%" }}
												disabled={isDisabled}
												showTime={{
													hideDisabledOptions: true,
													defaultValue: [moment(null, 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],

												}}
												format="YYYY-MM-DD HH:mm:ss" onChange={(date, dateString) => { getAuctionsChange(date, dateString) }}
												onOk={(date) => {
													if (new Date(date[0]).getTime() < new Date(detail.effectiveStartTime).getTime() || new Date(date[1]).getTime() > new Date(detail.effectiveEndTime).getTime()) {
														liveBroadcastRelats.BID[0].startTime = null
														liveBroadcastRelats.BID[0].endTime = null
														dispatch({
															type: 'updateStore',
															payload: {
																liveBroadcastRelats
															}
														})
														form.resetFields(['seckillTime'])
														message.error('竞拍活动时间一定要在直播时间段范围内', () => {
														})
														return false
													}

												}}
											/>

										)}
									</FormItem>
								</Col> : ''}
							</Row>
							<Row>
								<Col span={6}>
									<FormItem {...formItemLayout5} label="直播间优惠券">
										{getFieldDecorator('coupon', {
											rules: [{
												required: false, message: '请选择直播间优惠券'
											}],
											initialValue: liveBroadcastRelats.COUPONS.length ? liveBroadcastRelats.COUPONS[0].title : '',
										})(
											<Button disabled={isDisabled} onClick={() => { couponModal('coupon', true) }}>选择直播间优惠券 </Button>
										)}
									</FormItem>
								</Col>
								{liveBroadcastRelats.COUPONS.length ? <Col span={6} className={cx('label')}>优惠券名称：<div className={cx('div')}>{liveBroadcastRelats.COUPONS[0].title} {!isDisabled && <Icon className={cx('close')} type="close" onClick={() => { deleteItem('COUPONS') }} />}</div></Col> : ''}
								{liveBroadcastRelats.COUPONS.length ? <Col span={12}>
									<FormItem
										{...formItemLayoutTime}
										label="直播间领券时间"
									>
										{getFieldDecorator('getCoupon', {
											rules: [{ required: true, message: '请选择有效期' },
											],
											initialValue: liveBroadcastRelats.COUPONS.length && liveBroadcastRelats.COUPONS[0].startTime ? [moment(liveBroadcastRelats.COUPONS[0].startTime, 'YYYY-MM-DD HH:mm:ss'), moment(liveBroadcastRelats.COUPONS[0].endTime, 'YYYY-MM-DD HH:mm:ss')] : [],
										})(

											<RangePicker
												style={{ width: "100%" }}
												disabled={isDisabled}
												showTime={{
													hideDisabledOptions: true,
													defaultValue: [moment(null, 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],

												}}
												format="YYYY-MM-DD HH:mm:ss" onChange={(date, dateString) => { getCouponChange(date, dateString) }}
											/>

										)}
									</FormItem>
								</Col> : ''}
							</Row>

						</CollapsiblePanels>}



				</Form>



			</div>

			<Modal title={'示例图'}
				onCancel={() => { changeImgModal(false) }}
				onOk={() => { changeImgModal(false) }}
				footer={null}
				width={'80%'}
				visible={imgModal.visible}
				destroyOnClose={true}
			>
				<Row justify={'space-between'} align={'center'} type={'flex'}>
					{imgModal.srcs.length == 1 &&
						<Col span={24} style={{ display: 'flex', justifyContent: 'center' }}>
							<img style={{ height: '600px' }} className={cx('demoImg')} src={imgModal.srcs[0]} alt="" />
						</Col>
					}
					{imgModal.srcs.length == 2 &&
						<Col span={24}>
							<img width={'49%'} src={imgModal.srcs[0]} alt="" />
							<img width={'49%'} className={'fr'} src={imgModal.srcs[1]} alt="" />
						</Col>
					}
				</Row>
			</Modal>
			<Modal
				title={'选择主播'}
				visible={searchBox.visible}
				onCancel={() => { changeSearchBox(false) }}
				onOk={() => { changeSearchOk() }}
				width={'60%'}
				destroyOnClose={true}
			>
				{
					<div>
						<Row>
							<Col span={6}>
								<FormItem {...formItemLayout1} label="姓名" hasFeedback>
									<Input value={detailData.name} onChange={e => searchChange('name', e.target.value)} />
								</FormItem>
							</Col>

							<Col span={6}>
								<FormItem {...formItemLayout1} label="手机号" hasFeedback>
									<Input value={detailData.mobile} onChange={e => searchChange('mobile', e.target.value)} />
								</FormItem>
							</Col>

							<Col span={6}>
								<Button type='primary' style={{ marginTop: 4, marginLeft: 32 }} onClick={() => { handleSearch() }}>搜索</Button>
							</Col>

						</Row>
					</div>
				}
				<div>
					<Table
						dataSource={consultantList}
						columns={columns}
						rowSelection={{ type: 'radio', ...rowSelection }}
					>
					</Table>
				</div>
			</Modal>

			<Modal
				title={'选择游戏'}
				visible={gameObj.visible}
				onCancel={() => { gameOk(true) }}
				onOk={() => { gameOk(true) }}
				width={'60%'}
				destroyOnClose={true}
			>
				<ListPage pageProps={gamePageProps}></ListPage>
			</Modal>

			<Modal
				title={`选择${killObj.type == "auction" ? "竞拍" : "秒杀"}活动`}
				visible={killObj.visible}
				onCancel={() => { killOk(true) }}
				onOk={() => { killOk(true) }}
				width={'60%'}
				destroyOnClose={true}
			>
				<ListPage pageProps={killPageProps}></ListPage>
			</Modal>

			<Modal
				title={'选择优惠券'}
				visible={couponObj.visible}
				onCancel={() => { couponOk(true) }}
				onOk={() => { couponOk(true) }}
				width={'80%'}
				destroyOnClose={true}
			>
				<ListPage pageProps={couponPageProps}></ListPage>
			</Modal>

			{/*活动弹窗*/}
			<SelectModal
				visible={activityModalObj.visible}
				updateModal={updateModal}
				pageProps={pageProps}
				activityModalObj={activityModalObj}
				form={form}
				changeState={changeState}
				confirmHref={confirmHref}
				destroyOnClose={true}
			/>
		</div>
	)
}

// 连接视图(view)和模型(model)
export default connect(mapStateToProps)(Form.create()(liveDetailView))
